﻿<Page:BasePage 
    xmlns:Page="clr-namespace:Tfs.OnTheRoad.Pages"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:Mvvm="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7"
    xmlns:Controls="clr-namespace:Tfs.OnTheRoad.Controls"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
	x:Class="Tfs_OnTheRoad.SettingsPage"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	shell:SystemTray.IsVisible="true" SupportedOrientations="Portrait"  ApplicationBarButtons="About" >
    <!--Enabling Page Transitions-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" Background="Transparent">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

        <Controls:HeaderControl HeaderTitle="{Binding PageTitle}" ProfileNameVisibility="Collapsed"></Controls:HeaderControl>
        
        <!--ContentPanel - place additional content here-->
        <ScrollViewer Grid.Row="1" Margin="0" Padding="0">
        <Grid x:Name="ContentPanel" Margin="12,0,12,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200*"/>
                <ColumnDefinition Width="80*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Margin="12,0,0,0"  Grid.ColumnSpan="4" Grid.Row="0" >Profile Name</TextBlock>
            <TextBlock Grid.Column="5" Margin="12,0,0,0" >Default?</TextBlock>
            <TextBox x:Name="profileTextBox" Grid.Column="0" Grid.Row="1"  Grid.ColumnSpan="4" Text="{Binding ProfileName,Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="TextChangedUpdateTrigger"></TextBox>
            <CheckBox  Grid.Column="5" HorizontalAlignment="Center" Grid.Row="1" IsChecked="{Binding IsDefault,Mode=TwoWay}" ></CheckBox>

            <TextBlock Grid.Column="0" Margin="12,0,0,0"  Grid.ColumnSpan="3" Grid.Row="2" >TFS OData Endpoint</TextBlock>
            <TextBlock Grid.Column="3" Margin="12,0,0,0"  Grid.Row="2" Grid.ColumnSpan="2">Project Collection</TextBlock>

                <TextBox x:Name="endpointTextBox" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Text="{Binding TfsOdataEndPoint,Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="TextChangedUpdateTrigger"></TextBox>
            <TextBlock Grid.Column="2" Grid.Row="3" VerticalAlignment="Center">/</TextBlock>
                <TextBox x:Name="projectTextBox" Grid.Column="3" Grid.Row="3" Text="{Binding ProjectCollection,Mode=TwoWay, UpdateSourceTrigger=Explicit}" Grid.ColumnSpan="2" TextChanged="TextChangedUpdateTrigger"></TextBox>


            <TextBlock Grid.Column="0" Margin="12,0,0,0"  Grid.Row="4" >Domain</TextBlock>
            <TextBlock Grid.Column="1" Grid.ColumnSpan="4" Margin="12,0,0,0"  Grid.Row="4">Username</TextBlock>


                <TextBox x:Name="domainTextBox" Grid.Column="0" Grid.Row="5" Text="{Binding Domain,Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="TextChangedUpdateTrigger"></TextBox>
            <Grid Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" VerticalAlignment="Center">\</TextBlock>
                    <TextBox x:Name="userNameTextBox" Grid.Column="1" Text="{Binding UserName,Mode=TwoWay, UpdateSourceTrigger=Explicit}"  HorizontalAlignment="Stretch" TextChanged="TextChangedUpdateTrigger"></TextBox>                
            </Grid>
                       
            <TextBlock Margin="12,0,0,0" Grid.Row="6" Grid.ColumnSpan="5">Password</TextBlock>
                <PasswordBox x:Name="passwordTextBox" Grid.Row="7" Grid.ColumnSpan="5" Password="{Binding Password,Mode=TwoWay, UpdateSourceTrigger=Explicit}" PasswordChanged="PasswordChangedUpdateTrigger"></PasswordBox>

                <TextBlock Style="{StaticResource AccentTextBlock}"  Margin="12" Grid.Row="9" Grid.ColumnSpan="5" Text="{Binding FullAddress}"></TextBlock>

            <StackPanel Grid.Row="8" Grid.ColumnSpan="5" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Margin="0,0,20,0" toolkit:TiltEffect.IsTiltEnabled="True" Width="280" Style="{StaticResource ButtonStyle}" Content="More Information">
                        <Interactivity:Interaction.Triggers>
                            <Interactivity:EventTrigger EventName="Click">
                                <Mvvm:EventToCommand Command="{Binding NavigateToHelp}"></Mvvm:EventToCommand>
                            </Interactivity:EventTrigger>
                        </Interactivity:Interaction.Triggers> 
                    </Button>
                <Button toolkit:TiltEffect.IsTiltEnabled="True" IsEnabled="{Binding CanTest}" x:Name="testButton" Width="150" Style="{StaticResource ButtonStyle}" Content="OK">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="Click">
                            <Mvvm:EventToCommand Command="{Binding TestSettings}"></Mvvm:EventToCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Button>
            </StackPanel>

            <toolkit:PerformanceProgressBar Grid.Row="9" Height="20" IsIndeterminate="True"  Grid.ColumnSpan="5" Visibility="{Binding LogingIn, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            
            <TextBlock TextWrapping="Wrap"  Margin="12" Grid.Row="10" Grid.ColumnSpan="5" Text="{Binding TestResults}"></TextBlock>

            </Grid>
        </ScrollViewer>        
    </Grid>
</Page:BasePage>